package com.bd.module.salegood.pojo;
import java.util.*;
import java.io.*;
/**
 * Description:s商品销售实体类
 * createDate：2013-12-03
 * author：刘洋15
 * @version 1.0
 * 把商品存入实体，整合info_goods与info_goodsprice在销售中必要的列数据,
 * 用于提供JTable中的每一个单元数据
 */
public class Goods  implements Serializable{
private static final long serialVersionUID = 4924709068414974286L;
/**初始化JTable的列名*/
public static final String[] COLUMN_NAMES = {"商品代码","商品名称","单价","数量","折率","实收金额"};
/**商品代码*/
private String goodsCode;
/**商品名称*/
private String goodsName;
/**单价*/
private double retailprice;
/**数量*/
private int goodsNum;
/**折率*/
private double rate;
/**实收金额*/
private double money;
/**提取商品代码（条码号）*/
public String getGoodsCode() {
	return goodsCode;
}
/**设置商品代码（条码号）*/
public void setGoodsCode(String goodsCode) {
	this.goodsCode = goodsCode;
}
/**提取商品名称*/
public String getGoodsName() {
	return goodsName;
}
/**设置商品名称*/
public void setGoodsName(String goodsName) {
	this.goodsName = goodsName;
}
/**提取单价*/
public double getRetailprice() {
	return retailprice;
}
/**设置单价*/
public void setRetailprice(double retailprice) {
	this.retailprice = Math.floor(retailprice * 100.0 + 0.5)/100.0;
}
/**设置Double类型的单价*/
public void setRetailprice(Double retailprice) {
	this.retailprice =retailprice.doubleValue() ;
}
/**提取数量*/
public int getGoodsNum() {
	return goodsNum;
}
/**设置int类型的数量*/
public void setGoodsNum(int goodsNum) {
	this.goodsNum = goodsNum;
}
/**提取折扣率*/
public double getRate() {
	return rate;
}
/**设置折扣值*/
public void setRate(double rate) {
	this.rate = Math.floor(rate * 100.0 + 0.5)/100.0;
}
/**设置Double折扣值*/
public void setRate(Double rate) {
	this.rate = rate.doubleValue();
}
/**提取实收钱数*/
public double getMoney() {
	return money;
}
/**设置实收钱数*/
public void setMoney() {
	double d = getRetailprice() * getGoodsNum() * getRate();
	this.money=Math.floor(d * 100.0 + 0.5)/100.0;            //使钱数精确到小数点后两位
}
/**
 * 将Goods的属性参数转化成Vector对象供table使用
 * @return
 */
public Vector getVector(){
	Vector v = new Vector();
	v.addElement(goodsCode);
	v.addElement(goodsName);
	v.addElement(new Double(retailprice));
	v.addElement(new Integer(goodsNum));
	v.addElement(new Double(rate));
	v.addElement(new Double(money));
	return v;
}
/**
 * 这个类将把Vector对象转化成Goods对象
 * @param v
 */
public void setVector(Vector v){
	setGoodsCode((String)v.elementAt(0));
	setGoodsName((String)v.elementAt(1));
	setRetailprice((Double)v.elementAt(2));
	setGoodsNum((Integer)v.elementAt(3));
	setRate((Double)v.elementAt(4));
	setMoney();
}

}
